﻿﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Xml.Serialization;
using Fcdbas.Core;
using Fcdbas.Core.Configuration;
using Fcdbas.Core.DataAccess;

namespace Fcdbas.CustomerOrder
{
    /// <summary>LU=CustomerOrder^PROMPT=Customer Order^MODULE=ORDER^VIEW=Customer_Order_Tab^PKG=CustomerOrderApi^</summary>
    [Serializable]
    [DataObject]
    [Description("LU=CustomerOrder^PROMPT=Customer Order^MODULE=ORDER^VIEW=Customer_Order_Tab^PKG=CustomerOrderApi^")]
    [BindIndex("PRIMARY", true, "order_no")]
    [BindIndex("customer_order_1ix", false, "customer_no")]
    [BindTable("customer_order_tab", Description = "LU=CustomerOrder^PROMPT=Customer Order^MODULE=ORDER^VIEW=Customer_Order_Tab^PKG=CustomerOrderApi^", ConnName = "", DbType = DatabaseType.MySql)]
    public partial class Customer_Order_Tab : Icustomer_order_tab_cn
    {
        #region 属性
        private String _order_no;
        /// <summary>FLAGS=KMI-L^DATATYPE=VARCHAR(12)^PROMPT=Order No^</summary>
        [DisplayName("OrderNo")]
        [Description("FLAGS=KMI-L^DATATYPE=VARCHAR(12)^PROMPT=Order No^")]
        [DataObjectField(true, false, false, 12)]
        [BindColumn(1, "order_no", "订单号", null, "varchar(12)", 0, 0, false)]
        public virtual String order_no
        {
            get { return _order_no; }
            set { if (OnPropertyChanging(__.order_no, value)) { _order_no = value; OnPropertyChanged(__.order_no); } }
        }

        private String _contract;
        /// <summary>FLAGS=AMI-L^DATATYPE=STRING(5)^PROMPT=Contract^REF=Site^</summary>
        [DisplayName("Contract")]
        [Description("FLAGS=AMI-L^DATATYPE=STRING(5)^PROMPT=Contract^REF=Site^")]
        [DataObjectField(false, false, false, 5)]
        [BindColumn(2, "contract", "FLAGS=AMI-L^DATATYPE=STRING(5)^PROMPT=Contract^REF=Site^", null, "varchar(5)", 0, 0, false)]
        public virtual String contract
        {
            get { return _contract; }
            set { if (OnPropertyChanging(__.contract, value)) { _contract = value; OnPropertyChanged(__.contract); } }
        }

        private String _customer_no;
        /// <summary>FLAGS=AMI-L^DATATYPE=STRING(20)^PROMPT=Customer No^REF=CustomerInfo^</summary>
        [DisplayName("CustomerNo")]
        [Description("FLAGS=AMI-L^DATATYPE=STRING(20)^PROMPT=Customer No^REF=CustomerInfo^")]
        [DataObjectField(false, false, false, 20)]
        [BindColumn(3, "customer_no", "FLAGS=AMI-L^DATATYPE=STRING(20)^PROMPT=Customer No^REF=CustomerInfo^", null, "varchar(20)", 0, 0, false)]
        public virtual String customer_no
        {
            get { return _customer_no; }
            set { if (OnPropertyChanging(__.customer_no, value)) { _customer_no = value; OnPropertyChanged(__.customer_no); } }
        }

        private DateTime _delivery_date;
        /// <summary>FLAGS=AMINL^DATATYPE=DATE/DATETIME^PROMPT=Delivery Date^</summary>
        [DisplayName("DeliveryDate")]
        [Description("FLAGS=AMINL^DATATYPE=DATE/DATETIME^PROMPT=Delivery Date^")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn(4, "delivery_date", "FLAGS=AMINL^DATATYPE=DATE/DATETIME^PROMPT=Delivery Date^", null, "datetime", 0, 0, false)]
        public virtual DateTime delivery_date
        {
            get { return _delivery_date; }
            set { if (OnPropertyChanging(__.delivery_date, value)) { _delivery_date = value; OnPropertyChanged(__.delivery_date); } }
        }

        private Decimal _order_amount;
        /// <summary>FLAGS=A-IUL^DATATYPE=NUMBER/DECIMAL^PROMPT=Order Amount^</summary>
        [DisplayName("OrderAmount")]
        [Description("FLAGS=A-IUL^DATATYPE=NUMBER/DECIMAL^PROMPT=Order Amount^")]
        [DataObjectField(false, false, true, 30)]
        [BindColumn(5, "order_amount", "FLAGS=A-IUL^DATATYPE=NUMBER/DECIMAL^PROMPT=Order Amount^", null, "decimal(30,2)", 30, 2, false)]
        public virtual Decimal order_amount
        {
            get { return _order_amount; }
            set { if (OnPropertyChanging(__.order_amount, value)) { _order_amount = value; OnPropertyChanged(__.order_amount); } }
        }

        private String _objid;
        /// <summary></summary>
        [DisplayName("objid")]
        [Description("")]
        [DataObjectField(false, false, false, 50)]
        [BindColumn(6, "objid", "", null, "varchar(50)", 0, 0, false)]
        public virtual String objid
        {
            get { return _objid; }
            set { if (OnPropertyChanging(__.objid, value)) { _objid = value; OnPropertyChanged(__.objid); } }
        }

        private DateTime _objversion;
        /// <summary></summary>
        [DisplayName("objversion")]
        [Description("")]
        [DataObjectField(false, false, false, 0)]
        [BindColumn(7, "objversion", "", null, "datetime", 0, 0, false)]
        public virtual DateTime objversion
        {
            get { return _objversion; }
            set { if (OnPropertyChanging(__.objversion, value)) { _objversion = value; OnPropertyChanged(__.objversion); } }
        }
        #endregion

        #region 获取/设置 字段值
        /// <summary>
        /// 获取/设置 字段值。
        /// 一个索引，基类使用反射实现。
        /// 派生实体类可重写该索引，以避免反射带来的性能损耗
        /// </summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        public override Object this[String name]
        {
            get
            {
                switch (name)
                {
                    case __.order_no: return _order_no;
                    case __.contract: return _contract;
                    case __.customer_no: return _customer_no;
                    case __.delivery_date: return _delivery_date;
                    case __.order_amount: return _order_amount;
                    case __.objid: return _objid;
                    case __.objversion: return _objversion;
                    default: return base[name];
                }
            }
            set
            {
                switch (name)
                {
                    case __.order_no: _order_no = Convert.ToString(value); break;
                    case __.contract: _contract = Convert.ToString(value); break;
                    case __.customer_no: _customer_no = Convert.ToString(value); break;
                    case __.delivery_date: _delivery_date = Convert.ToDateTime(value); break;
                    case __.order_amount: _order_amount = Convert.ToDecimal(value); break;
                    case __.objid: _objid = Convert.ToString(value); break;
                    case __.objversion: _objversion = Convert.ToDateTime(value); break;
                    default: base[name] = value; break;
                }
            }
        }
        #endregion

        #region 字段名
        /// <summary>取得LU=CustomerOrder^PROMPT=Customer Order^MODULE=ORDER^VIEW=Customer_Order_Tab^PKG=CustomerOrderApi^字段信息的快捷方式</summary>
        public class _
        {
            ///<summary>FLAGS=KMI-L^DATATYPE=VARCHAR(12)^PROMPT=Order No^</summary>
            public static readonly Field order_no = FindByName(__.order_no);

            ///<summary>FLAGS=AMI-L^DATATYPE=STRING(5)^PROMPT=Contract^REF=Site^</summary>
            public static readonly Field contract = FindByName(__.contract);

            ///<summary>FLAGS=AMI-L^DATATYPE=STRING(20)^PROMPT=Customer No^REF=CustomerInfo^</summary>
            public static readonly Field customer_no = FindByName(__.customer_no);

            ///<summary>FLAGS=AMINL^DATATYPE=DATE/DATETIME^PROMPT=Delivery Date^</summary>
            public static readonly Field delivery_date = FindByName(__.delivery_date);

            ///<summary>FLAGS=A-IUL^DATATYPE=NUMBER/DECIMAL^PROMPT=Order Amount^</summary>
            public static readonly Field order_amount = FindByName(__.order_amount);

            ///<summary></summary>
            public static readonly Field objid = FindByName(__.objid);

            ///<summary></summary>
            public static readonly Field objversion = FindByName(__.objversion);

            static Field FindByName(String name) { return Meta.Table.FindByName(name); }
        }

        /// <summary>取得LU=CustomerOrder^PROMPT=Customer Order^MODULE=ORDER^VIEW=Customer_Order_Tab^PKG=CustomerOrderApi^字段名称的快捷方式</summary>
        class __
        {
            ///<summary>FLAGS=KMI-L^DATATYPE=VARCHAR(12)^PROMPT=Order No^</summary>
            public const String order_no = "order_no";

            ///<summary>FLAGS=AMI-L^DATATYPE=STRING(5)^PROMPT=Contract^REF=Site^</summary>
            public const String contract = "contract";

            ///<summary>FLAGS=AMI-L^DATATYPE=STRING(20)^PROMPT=Customer No^REF=CustomerInfo^</summary>
            public const String customer_no = "customer_no";

            ///<summary>FLAGS=AMINL^DATATYPE=DATE/DATETIME^PROMPT=Delivery Date^</summary>
            public const String delivery_date = "delivery_date";

            ///<summary>FLAGS=A-IUL^DATATYPE=NUMBER/DECIMAL^PROMPT=Order Amount^</summary>
            public const String order_amount = "order_amount";

            ///<summary></summary>
            public const String objid = "objid";

            ///<summary></summary>
            public const String objversion = "objversion";

        }
        #endregion
    }

    /// <summary>LU=CustomerOrder^PROMPT=Customer Order^MODULE=ORDER^VIEW=Customer_Order_Tab^PKG=CustomerOrderApi^接口</summary>
    public partial interface Icustomer_order_tab_cn
    {
        #region 属性
        /// <summary>FLAGS=KMI-L^DATATYPE=VARCHAR(12)^PROMPT=Order No^</summary>
        String order_no { get; set; }

        /// <summary>FLAGS=AMI-L^DATATYPE=STRING(5)^PROMPT=Contract^REF=Site^</summary>
        String contract { get; set; }

        /// <summary>FLAGS=AMI-L^DATATYPE=STRING(20)^PROMPT=Customer No^REF=CustomerInfo^</summary>
        String customer_no { get; set; }

        /// <summary>FLAGS=AMINL^DATATYPE=DATE/DATETIME^PROMPT=Delivery Date^</summary>
        DateTime delivery_date { get; set; }

        /// <summary>FLAGS=A-IUL^DATATYPE=NUMBER/DECIMAL^PROMPT=Order Amount^</summary>
        Decimal order_amount { get; set; }

        /// <summary></summary>
        String objid { get; set; }

        /// <summary></summary>
        DateTime objversion { get; set; }
        #endregion

        #region 获取/设置 字段值
        /// <summary>获取/设置 字段值。</summary>
        /// <param name="name">字段名</param>
        /// <returns></returns>
        Object this[String name] { get; set; }
        #endregion
    }
}